import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
import pandas as pd
import seaborn as sns

def get_plot(lmbda, mu, reg_loss):

    #00
    pod = [1, 0.9916677996989712, 0.9705819492449236, 0.9126045669550532, 0.6842491059180319, 0.18889723754797494, 0.03132226062605402]
    pofd = [1, 0.2618434590003376, 0.12611379518050858, 0.05018943894055746, 0.007792863614635416, 0.0001848983976283574, 5.317584296349722e-06]
    
    pod = [1, 0.994845060814018, 0.9848297708412348, 0.9710077308583136, 0.9259125680713882, 0.19246736270630133, 0.0295330237173478]
    pofd = [1, 0.26199784637836, 0.1351952206000823, 0.07792461342845868, 0.02518209496685207, 0.00018418688987039512, 3.538814901444005e-06]

    #10
    #pod = [1, 0.9941559386397409, 0.981329297352998, 0.9578123173730824, 0.8555188214555768, 0.1834734715394212, 0.028924287203413886]
    #pofd = [1, 0.26199784637836, 0.1351952206000823, 0.07792461342845868, 0.02518209496685207, 0.00018418688987039512, 3.538814901444005e-06]

    #20
    #pod = [1, 0.994845060814018, 0.9848297708412348, 0.9710077308583136, 0.9259125680713882, 0.19246736270630133, 0.0295330237173478]
    #pofd = [1, 0.2706584498754955, 0.14391294814924666, 0.0946114352143433, 0.04871058878952121, 0.00020658066035783966, 5.130345412675437e-06]


    tpr = pod
    fpr = pofd

    roc_auc = auc(fpr, tpr)

    plt.figure()
    plt.plot(fpr, tpr, color='darkorange', lw=2, label='(AUC = %0.4f)' % roc_auc)
    plt.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')
    plt.xlim([0., 1.])
    plt.ylim([0., 1.])
    plt.xlabel('Probability Of False Detection (POFD)')
    plt.ylabel('Probability Of Detection (POD)')
    plt.title(u"ROC {} λ={:d}, μ={:d}".format(reg_loss, lmbda, mu))
    plt.legend(loc="lower right")
    #plt.show()
    plt.savefig('roc_{}_{}{}.png'.format(reg_loss.lower(), lmbda, mu))
    print("done")

#get_plot(0, 0, "MSE")
get_plot(2, 0, "MSE")
